package cate.game.role.pvp.throne.msg;

import cate.game.GameBody;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgOutput;
import cate.game.client.msg.id.MsgIdBTB;
import cate.game.pvp.throne.TBGameDataManager;
import cate.game.pvp.throne.data.ko.TBKoChampionRecord;
import cate.game.pvp.throne.data.ko.TBKoTimeTable;
import cate.game.pvp.throne.dto.TBBaseDTO;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "王座争霸基础数据 の 返回")
public class TBBaseResp implements MsgOutput {

    @NoteField("数据准备好")
    public boolean dataReady;

    @NoteField(value = "基础数据", detail = "数据没准备好则为null")
    public TBBaseDTO base;

    @NoteField("淘汰赛时间表")
    public TBKoTimeTable koTimeTable;

    @NoteField("当前赛季的冠军")
    public TBKoChampionRecord champion;

    @NoteField("上赛季的冠军")
    public TBKoChampionRecord lastChampion;

    public TBBaseResp(GameBody game) {
        TBGameDataManager manager = game.pvp.throne.data;
        dataReady = manager.isDataReady();
        if (dataReady) {
            base = manager.holder.base;
            koTimeTable = manager.holder.koBase.timeTable;
            champion = manager.holder.koBase.champions.get(base.season.index);
            lastChampion = manager.holder.koBase.champions.get(base.season.index - 1);
        }
    }

    public TBBaseResp() {
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTB.BASE_RESP;
    }
}
